var t = getApp();

Page({
    data: {
        index: '',
        inputLen: 0,
        maxLen: 5e3,
        content: "",
        error: !1,
    },
    oninput: function (t) {
        var a = t.detail.value;
        this.data.textValue = a;
        this.setData({
            inputLen: a.length
        }), a.length > this.data.maxLen ? this.setData({
            error: !0
        }) : this.setData({
            error: !1
        });
    },
    onconfirm: function (a) {
        var e = a.detail.value || this.data.textValue;
        if(e !== ''){
            if (this.frompost){
                wx.redirectTo({
                    url: "../edit/edit?text=" + e
                });
            }else{
                t.globalData.editArticleParaList = e, t.globalData.ed_id = this.data.index,wx.navigateBack();
            }
        }else{
            wx.showToast({
                title: '输入内容不能为空',
                icon: 'none'
            })
        }
    },
    onLoad: function (a) {
        var e = a.index, n = a.conText;
        this.frompost = a.frompost;
        this.data.index = e;
        n && (this.setData({
            content: n
        }), this.setData({
            inputLen: n.length
        }));
    },
    onReady: function () {
        wx.setNavigationBarTitle({
            title: "编辑文字"
        });
    },
    onShow: function () { },
    onHide: function () { },
    onUnload: function () { },
    onPullDownRefresh: function () { },
    onReachBottom: function () { }
});